﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="RR73_v1Response", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR73V1Response))]
    public class RR73V1ResponseSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IRR73V1Response clazz;
        
        public RR73V1ResponseSerializer(IRR73V1Response clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("outIsikukood");
            if (clazz.OutIsikukood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutIsikukood))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutIsikukood");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outPerenimi");
            if (clazz.OutPerenimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutPerenimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutPerenimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outEesnimi");
            if (clazz.OutEesnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutEesnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutEesnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outMK");
            if (clazz.OutMK!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutMK))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutMK");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outMKnimi");
            if (clazz.OutMKnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutMKnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutMKnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outVK");
            if (clazz.OutVK!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutVK))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutVK");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outVKnimi");
            if (clazz.OutVKnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutVKnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutVKnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outAK");
            if (clazz.OutAK!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutAK))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutAK");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outAKnimi");
            if (clazz.OutAKnimi!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutAKnimi))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutAKnimi");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outTanav");
            if (clazz.OutTanav!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutTanav))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutTanav");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outMaja");
            if (clazz.OutMaja!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutMaja))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutMaja");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outKorter");
            if (clazz.OutKorter!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutKorter))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutKorter");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outAadrTXT");
            if (clazz.OutAadrTXT!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutAadrTXT))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutAadrTXT");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outValRK");
            if (clazz.OutValRK!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutValRK))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutValRK");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outValJSK");
            if (clazz.OutValJSK!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutValJSK))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutValJSK");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outValJSKnm");
            if (clazz.OutValJSKnm!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutValJSKnm))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutValJSKnm");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outValOV");
            if (clazz.OutValOV!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutValOV))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutValOV");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outValOVnm");
            if (clazz.OutValOVnm!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutValOVnm))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutValOVnm");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outValHAALET");
            if (clazz.OutValHAALET!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutValHAALET))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutValHAALET");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outValEELHAALET");
            if (clazz.OutValEELHAALET!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutValEELHAALET))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutValEELHAALET");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("outValMKinfo");
            if (clazz.OutValMKinfo!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OutValMKinfo))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OutValMKinfo");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("poiVeaKood");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "integer");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdInteger(((decimal)(clazz.PoiVeaKood))).ToString());
            Writer.WriteEndElement();
            Writer.WriteStartElement("pocVeaTekst");
            if (clazz.PocVeaTekst!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.PocVeaTekst))).ToString());
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : PocVeaTekst");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("VRandmed");
            if (clazz.VRandmed!=null) {
                Writer.WriteTypeAttribute("http://schemas.xmlsoap.org/soap/encoding/", "Array");
                Writer.WriteArrayTypeAttribute(">>>RR73_v1Response>VRandmed>VRandmed", "http://producers.rr.xtee.riik.ee/producer/rr", clazz.VRandmed.Count);
                for (int x = 0; ((clazz.VRandmed != null) 
                            && (x < clazz.VRandmed.Count)); x = (x + 1)) {
                    if (clazz.VRandmed[x]!=null) {
                        Writer.WriteStartElement("VRandmed");
                        global::Xtee.Core.SerializationMetadata metaVRandmed = this.GetMetaData(clazz.VRandmed[x]);
                        Writer.WriteTypeAttribute(metaVRandmed.TypeQualifiedName.Namespace, metaVRandmed.TypeQualifiedName.Name);
                        metaVRandmed.NewSerializer(clazz.VRandmed[x]).WriteXml(Writer);
                        Writer.WriteEndElement();
                    }
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmed");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="outIsikukood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outIsikukood");
                }
                clazz.OutIsikukood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outIsikukood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outIsikukood", Reader.LocalName);
            }
            if (Reader.LocalName=="outPerenimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outPerenimi");
                }
                clazz.OutPerenimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outPerenimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outPerenimi", Reader.LocalName);
            }
            if (Reader.LocalName=="outEesnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outEesnimi");
                }
                clazz.OutEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outEesnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outEesnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="outMK") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outMK");
                }
                clazz.OutMK = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outMK")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outMK", Reader.LocalName);
            }
            if (Reader.LocalName=="outMKnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outMKnimi");
                }
                clazz.OutMKnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outMKnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outMKnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="outVK") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outVK");
                }
                clazz.OutVK = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outVK")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outVK", Reader.LocalName);
            }
            if (Reader.LocalName=="outVKnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outVKnimi");
                }
                clazz.OutVKnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outVKnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outVKnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="outAK") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outAK");
                }
                clazz.OutAK = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outAK")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outAK", Reader.LocalName);
            }
            if (Reader.LocalName=="outAKnimi") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outAKnimi");
                }
                clazz.OutAKnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outAKnimi")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outAKnimi", Reader.LocalName);
            }
            if (Reader.LocalName=="outTanav") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outTanav");
                }
                clazz.OutTanav = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outTanav")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outTanav", Reader.LocalName);
            }
            if (Reader.LocalName=="outMaja") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outMaja");
                }
                clazz.OutMaja = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outMaja")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outMaja", Reader.LocalName);
            }
            if (Reader.LocalName=="outKorter") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outKorter");
                }
                clazz.OutKorter = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outKorter")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outKorter", Reader.LocalName);
            }
            if (Reader.LocalName=="outAadrTXT") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outAadrTXT");
                }
                clazz.OutAadrTXT = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outAadrTXT")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outAadrTXT", Reader.LocalName);
            }
            if (Reader.LocalName=="outValRK") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outValRK");
                }
                clazz.OutValRK = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outValRK")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outValRK", Reader.LocalName);
            }
            if (Reader.LocalName=="outValJSK") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outValJSK");
                }
                clazz.OutValJSK = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outValJSK")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outValJSK", Reader.LocalName);
            }
            if (Reader.LocalName=="outValJSKnm") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outValJSKnm");
                }
                clazz.OutValJSKnm = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outValJSKnm")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outValJSKnm", Reader.LocalName);
            }
            if (Reader.LocalName=="outValOV") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outValOV");
                }
                clazz.OutValOV = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outValOV")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outValOV", Reader.LocalName);
            }
            if (Reader.LocalName=="outValOVnm") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outValOVnm");
                }
                clazz.OutValOVnm = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outValOVnm")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outValOVnm", Reader.LocalName);
            }
            if (Reader.LocalName=="outValHAALET") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outValHAALET");
                }
                clazz.OutValHAALET = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outValHAALET")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outValHAALET", Reader.LocalName);
            }
            if (Reader.LocalName=="outValEELHAALET") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outValEELHAALET");
                }
                clazz.OutValEELHAALET = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outValEELHAALET")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outValEELHAALET", Reader.LocalName);
            }
            if (Reader.LocalName=="outValMKinfo") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>outValMKinfo");
                }
                clazz.OutValMKinfo = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("outValMKinfo")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>outValMKinfo", Reader.LocalName);
            }
            if (Reader.LocalName=="poiVeaKood") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>poiVeaKood");
                }
                clazz.PoiVeaKood = new global::Xtee.Core.Schema.XsdInteger(Reader.ReadElementString("poiVeaKood")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>poiVeaKood", Reader.LocalName);
            }
            if (Reader.LocalName=="pocVeaTekst") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>pocVeaTekst");
                }
                clazz.PocVeaTekst = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("pocVeaTekst")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>pocVeaTekst", Reader.LocalName);
            }
            if (Reader.LocalName=="VRandmed") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>RR73_v1Response>VRandmed");
                }
                clazz.VRandmed = new System.Collections.Generic.List<RR73V1Response.IVRandmedType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("VRandmed");
                    for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                                && (Reader.LocalName == "VRandmed")); ) {
                        if (Reader.IsElementNil()) {
                            throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>RR73_v1Response>VRandmed>VRandmed");
                        }
                        global::Xtee.Core.SerializationMetadata metaVRandmed = this.GetMetaData<RR73V1Response.IVRandmedType>(Reader, ">>>RR73_v1Response>VRandmed>VRandmed", "http://producers.rr.xtee.riik.ee/producer/rr");
                        RR73V1Response.IVRandmedType item = metaVRandmed.NewEntity<RR73V1Response.IVRandmedType>();
                        clazz.VRandmed.Add(item);
                        if ((Reader.IsEmptyElement == false)) {
                            Reader.ReadStartElement("VRandmed");
                            metaVRandmed.NewSerializer(item).ReadXml(Reader);
                            Reader.ReadEndElement();
                        }
                        else {
                            Reader.Skip();
                        }
                    }
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>RR73_v1Response>VRandmed", Reader.LocalName);
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>>RR73_v1Response>VRandmed>VRandmed", Namespace="http://producers.rr.xtee.riik.ee/producer/rr", Target=typeof(RR73V1Response.VRandmedType))]
        public class VRandmedTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected RR73V1Response.IVRandmedType clazz;
            
            public VRandmedTypeSerializer(RR73V1Response.IVRandmedType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("VRandmed.Kood");
                if (clazz.VRandmedKood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedKood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedKood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("VRandmed.Nimetus");
                if (clazz.VRandmedNimetus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedNimetus))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedNimetus");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("VRandmed.Riik");
                if (clazz.VRandmedRiik!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedRiik))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedRiik");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("VRandmed.Riiknm");
                if (clazz.VRandmedRiiknm!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedRiiknm))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedRiiknm");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("VRandmed.KiriTaot");
                if (clazz.VRandmedKiriTaot!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedKiriTaot))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedKiriTaot");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("VRandmed.KiriAadr");
                if (clazz.VRandmedKiriAadr!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedKiriAadr))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedKiriAadr");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("VRandmed.KiriKP");
                if (clazz.VRandmedKiriKP!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedKiriKP))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedKiriKP");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("VRandmed.KiriValKP");
                if (clazz.VRandmedKiriValKP!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedKiriValKP))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedKiriValKP");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("VRandmed.Haalet");
                if (clazz.VRandmedHaalet!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedHaalet))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedHaalet");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("VRandmed.HaaletAadr");
                if (clazz.VRandmedHaaletAadr!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedHaaletAadr))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedHaaletAadr");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("VRandmed.HaaletAjad");
                if (clazz.VRandmedHaaletAjad!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedHaaletAjad))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedHaaletAjad");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("VRandmed.Kontakt");
                if (clazz.VRandmedKontakt!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedKontakt))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedKontakt");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("VRandmed.KontaktAnd");
                if (clazz.VRandmedKontaktAnd!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VRandmedKontaktAnd))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VRandmedKontaktAnd");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="VRandmed.Kood") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.Kood");
                    }
                    clazz.VRandmedKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.Kood")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.Kood", Reader.LocalName);
                }
                if (Reader.LocalName=="VRandmed.Nimetus") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.Nimetus");
                    }
                    clazz.VRandmedNimetus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.Nimetus")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.Nimetus", Reader.LocalName);
                }
                if (Reader.LocalName=="VRandmed.Riik") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.Riik");
                    }
                    clazz.VRandmedRiik = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.Riik")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.Riik", Reader.LocalName);
                }
                if (Reader.LocalName=="VRandmed.Riiknm") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.Riiknm");
                    }
                    clazz.VRandmedRiiknm = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.Riiknm")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.Riiknm", Reader.LocalName);
                }
                if (Reader.LocalName=="VRandmed.KiriTaot") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.KiriTaot");
                    }
                    clazz.VRandmedKiriTaot = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.KiriTaot")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.KiriTaot", Reader.LocalName);
                }
                if (Reader.LocalName=="VRandmed.KiriAadr") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.KiriAadr");
                    }
                    clazz.VRandmedKiriAadr = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.KiriAadr")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.KiriAadr", Reader.LocalName);
                }
                if (Reader.LocalName=="VRandmed.KiriKP") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.KiriKP");
                    }
                    clazz.VRandmedKiriKP = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.KiriKP")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.KiriKP", Reader.LocalName);
                }
                if (Reader.LocalName=="VRandmed.KiriValKP") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.KiriValKP");
                    }
                    clazz.VRandmedKiriValKP = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.KiriValKP")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.KiriValKP", Reader.LocalName);
                }
                if (Reader.LocalName=="VRandmed.Haalet") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.Haalet");
                    }
                    clazz.VRandmedHaalet = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.Haalet")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.Haalet", Reader.LocalName);
                }
                if (Reader.LocalName=="VRandmed.HaaletAadr") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.HaaletAadr");
                    }
                    clazz.VRandmedHaaletAadr = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.HaaletAadr")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.HaaletAadr", Reader.LocalName);
                }
                if (Reader.LocalName=="VRandmed.HaaletAjad") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.HaaletAjad");
                    }
                    clazz.VRandmedHaaletAjad = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.HaaletAjad")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.HaaletAjad", Reader.LocalName);
                }
                if (Reader.LocalName=="VRandmed.Kontakt") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.Kontakt");
                    }
                    clazz.VRandmedKontakt = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.Kontakt")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.Kontakt", Reader.LocalName);
                }
                if (Reader.LocalName=="VRandmed.KontaktAnd") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.KontaktAnd");
                    }
                    clazz.VRandmedKontaktAnd = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VRandmed.KontaktAnd")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>>RR73_v1Response>VRandmed>VRandmed>VRandmed.KontaktAnd", Reader.LocalName);
                }
            }
        }
    }
}
